nums = [226,120,124,334,216,224,100,325,297,224]
ans = ""
wronginput = False
wordbuffer = ""
sumi = 0
a = input()
lencount = len(a)
for i in a:
    if i != " " and lencount != 1:
        wordbuffer += i
    else:
        if lencount == 1:
            wordbuffer += i
        count = len(wordbuffer)
        for f in wordbuffer:
            if count > 1:
                sumi += ord(f)
            else:
                sumi -= ord(f)
            count -= 1
        try:
            ans += str(nums.index(sumi))
        except ValueError:
            wronginput = True
            break
        wordbuffer = ""
        sumi = 0
    lencount -= 1
if wronginput == False:
    print(int(ans)-1)
else:
    print("Wrong imput")
